﻿@model AmorCanino.Web.Models.Models.Pet
@{
    var age = Math.Round((DateTime.Now - Model.BirthDate.Value).TotalDays / 365, 0);
    string picture = string.Empty;
    if (!Model.HasPicture) {
        picture = Url.Content("~/Content/noPic.png");
    } else {
        picture = Url.Content("~/ImageServices/getThumbnail.pet?pictureId=" + Model.PetId.ToString() + "&pictureType=adopt");
    }
}
<div class="adoptTemplate" data-userid="@Model.UserId" data-petid="@Model.PetId" data-raceid="@Model.RaceId">
    <div>
        <img src="@picture" 
            alt="@Model.PetName" title="@Model.PetName" />
    </div>
    <div class="adoptName">@Model.PetName</div>
    <div class="adoptRace">@Model.ReceName</div>
    <div class="adoptAge">@string.Format("{0} año{1}", age.ToString(), age != 1 ? "s" : "")</div>
</div>